<?php
declare(strict_types=1);

namespace Zms\Calculation;


use Exception;

/**
 * @describe 计算器
 * @user zlf <zms-pro@qq.com> 2025/3/19
 * @param string $formula 算式
 * @param int|null $precision 保留精度
 * @return float
 * @throws Exception
 */
function compute($formula, $precision = null)
{
    return Calculation::compute($formula, $precision);
}


/**
 * @describe 商品折扣
 * @user zlf <zms-pro@qq.com> 2025/4/27
 * @return int|false
 */
function discount($price, $line_price, $precision = 1)
{
    return Calculation::discount($price, $line_price, $precision);
}